package com.example.dto;

public class Result<T> {
    private boolean success;
    private String message;
    private T payload;

    public static Result ok(){
        Result result = new Result();
        result.success = true;
        return result;
    }

    public static Result fail(){
        Result result = new Result();
        result.success = false;
        return result;
    }

    public Result<T> msg(String message){
        this.message = message;
        return this;
    }

    public Result<T> data(T payload){
        this.payload = payload;
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getPayload() {
        return payload;
    }

    public void setPayload(T payload) {
        this.payload = payload;
    }
}
